{% load static %}
{% load comment_tags %}
<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="referrer" content="origin">
    <!-- TDK and ICO -->
    <title>{% block head_title %}{% endblock %}_{{ site_end_title }}</title>
    {% block metas %}
    <meta name="description" content="{{ site_description }}">
    <meta name="keywords" content="{{ site_keywords }}">
    {% endblock %}
    <link rel="shortcut icon" href="{% static 'blog/img/favicon.ico'%}" type="image/x-icon"/>
    <!-- Bootstrap and font-awesome CSS -->
    <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="{% static 'blog/js/headroom.min.js'%}"></script>
    <!-- blog CSS -->
    <link href="{% static 'blog/css/base.css' %}?v=20191123.0568" rel="stylesheet">
    {% block top-file %}{% endblock %}
    <!--根据cookies判断是否启用暗色主题-->
    {% if request.COOKIES.toggleTheme == "dark" %}
    <link id="theme-css-dark" href="/static/blog/css/night.css?20191123.01" rel="stylesheet">
    {% endif %}
</head>
<body>
<!--导航开始-->
{% include 'blog/tags/navbar.html' %}
<!--导航结束-->

<!--消息块-->
{% if messages %}
<div class="container">
    {% for message in messages %}
    <div class="alert {% if message.tags %}alert-{{ message.tags }}{% else %}alert-secondary{% endif %} alert-dismissible rounded-0 fade show" role="alert">
        {{ message }}
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    {% endfor %}
</div>
{% endif %}

<!--回到顶部按钮-->
<div class="text-center" id="to-top">
    <i class="fa fa-chevron-up" id="btn-top" title="回到顶部"></i>
</div>

<!--主要内容块-->
<main>{% block base_content %}{% endblock %}</main>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<!--js cookie 插件-->
<script src="{% static 'blog/js/js.cookie.min.js'%}?v=20191123.12"></script>
<script src="https://cdn.bootcss.com/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script>
$(function(){var myElement=document.querySelector(".blog-navbar");var headroom=new Headroom(myElement);headroom.init()});
</script>
<script src="{% static 'blog/js/base.js'%}?v=20191123.0909890"></script>
{% if user.is_authenticated %}
<script>
var msgs = {% get_notifications_count user 'false' %};
if(msgs>0){var _record=0;var myTitle=document.title;function titleBlink(){_record++;if(_record%2){document.title='【 】'+myTitle}else{document.title='【新消息】'+myTitle};setTimeout("titleBlink()",500)};titleBlink()}
</script>
{% endif %}
{% block end_file %}{% endblock %}
<footer class="container-fluid mt-4 py-0">
    <div class="card-body text-center px-0 f-14">
        <p class="card-text mb-1">Copyright&nbsp;&copy;&nbsp;<span id="year-info"></span>
            <a href="https://github.com/Hopetree" target="_blank" title="博客作者的Github">Hopetree</a>.&nbsp;Powered&nbsp;by&nbsp;Django.
        </p>
        <p class="mb-0">
            <a href="http://www.miibeian.gov.cn/" target="_blank">{{ beian }}</a>&nbsp;|
            <a href="{% url 'django.contrib.sitemaps.views.sitemap' %}" target="_blank">Sitemap</a>
            {% if cnzz_protocol %}|&nbsp;{{ cnzz_protocol|safe }}{% endif %}
            <span id="web-day"></span>
        </p>
        <script>function getnewYear(){var d = new Date();var old = new Date('2018/03/28');
            var x = document.getElementById("year-info");
            x.innerHTML=d.getFullYear();var y=document.getElementById("web-day");
            var dd=Math.floor((d.getTime() - old.getTime()) / (24 * 3600 * 1000));
            var d_str="| 网站已续航 "+dd+" 天";y.innerHTML=d_str;}getnewYear()</script>
    </div>
</footer>
</body>
</html>